@@ -31,10 +31,17 @@ public function processRequest() {
31
31
}
32
32
33
33
$ next_uri = $ this ->getRequest ()->getPath ();
34
- if ($ next_uri == '/login/ ' ) {
35
- $ next_uri = null ;
34
+ $ request ->setCookie ('next_uri ' , $ next_uri );
35
+ if ($ next_uri == '/login/ ' && !$ request ->isFormPost ()) {
36
+ // The user went straight to /login/, so presumably they want to go
37
+ // to the dashboard upon logging in. Because, you know, that's logical.
38
+ // And people are logical. Sometimes... Fine, no they're not.
39
+ // We check for POST here because getPath() would get reset to /login/.
40
+ $ request ->setCookie ('next_uri ' , '/ ' );
36
41
}
37
42
43
+ // Always use $request->getCookie('next_uri', '/') after the above.
44
+
38
45
$ password_auth = PhabricatorEnv::getEnvConfig ('auth.password-auth-enabled ' );
39
46
40
47
$ forms = array ();
@@ -66,7 +73,7 @@ public function processRequest() {
66
73
$ request ->setCookie ('phsid ' , $ session_key );
67
74
68
75
return id (new AphrontRedirectResponse ())
69
- ->setURI (' / ' );
76
+ ->setURI ($ request -> getCookie ( ' next_uri ' , ' / ' ) );
70
77
} else {
71
78
$ log = PhabricatorUserLog::newLog (
72
79
null ,
@@ -93,7 +100,6 @@ public function processRequest() {
93
100
$ form
94
101
->setUser ($ request ->getUser ())
95
102
->setAction ('/login/ ' )
96
- ->addHiddenInput ('next ' , $ next_uri )
97
103
->appendChild (
98
104
id (new AphrontFormTextControl ())
99
105
->setLabel ('Username/Email ' )
@@ -115,8 +121,6 @@ public function processRequest() {
115
121
$ forms ['Phabricator Login ' ] = $ form ;
116
122
}
117
123
118
- $ oauth_state = $ next_uri ;
119
-
120
124
$ providers = array (
121
125
PhabricatorOAuthProvider::PROVIDER_FACEBOOK ,
122
126
PhabricatorOAuthProvider::PROVIDER_GITHUB ,
@@ -160,7 +164,6 @@ public function processRequest() {
160
164
->addHiddenInput ('client_id ' , $ client_id )
161
165
->addHiddenInput ('redirect_uri ' , $ redirect_uri )
162
166
->addHiddenInput ('scope ' , $ minimum_scope )
163
- ->addHiddenInput ('state ' , $ oauth_state )
164
167
->setUser ($ request ->getUser ())
165
168
->setMethod ('GET ' )
166
169
->appendChild (
0 commit comments