Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] allow user to logout before set username #13439

Merged
merged 6 commits into from
Feb 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 15 additions & 17 deletions packages/rocketchat-ui-login/client/login/form.html
Original file line number Diff line number Diff line change
Expand Up @@ -119,33 +119,31 @@ <h2 data-i18n="Registration_Succeeded">{{{_ "Registration_Succeeded"}}}</h2>
</div>
{{/if}}
</div>
<div class="submit">
<button class='rc-button rc-button--primary login'><span>{{btnLoginSave}}</span></button>
</div>
<div class="rc-button__group rc-button__group--vertical">
<button class='rc-button rc-button--primary login'>{{btnLoginSave}}</button>
{{#if state 'login'}}
{{#if registrationAllowed}}
<div>
<button type="button" class="register">{{_ 'Register'}}</button>
</div>

<button type="button" class="rc-button rc-button--nude register">{{_ 'Register'}}</button>

{{else}}
{{#if linkReplacementText}}
<div class="register-link-replacement">
{{{linkReplacementText}}}
</div>
{{/if}}
{{#if linkReplacementText}}
<div class="register-link-replacement">
{{{linkReplacementText}}}
</div>
{{/if}}
{{/if}}
{{#if passwordResetAllowed}}
<div>
<button type="button" class="forgot-password">{{_ 'Forgot_password'}}</button>
</div>
<button type="button" class="rc-button rc-button--nude forgot-password">{{_ 'Forgot_password'}}</button>
{{/if}}
{{/if}}
</div>
{{/if}}
{{/if}}
{{#unless state 'login'}}
<div>
<button type="button" class="back-to-login">{{_ 'Back_to_login'}}</button>
</div>
<div class="rc-button__group rc-button__group--vertical">
<button type="button" class="rc-button rc-button--nude back-to-login">{{_ 'Back_to_login'}}</button>
</div>
{{/unless}}
</form>
<div class='login-terms'>
Expand Down
5 changes: 3 additions & 2 deletions packages/rocketchat-ui-login/client/username/username.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ <h2>{{_ "Username_title"}}</h2>
</div>

{{#if username.ready}}
<div class="submit">
<button data-loading-text="{{_ "Please_wait"}}..." class='button primary login'><span>{{_ "Use_this_username"}}</span></button>
<div class="rc-button__group rc-button__group--vertical">
<button data-loading-text="{{_ " Please_wait "}}..." class='rc-button rc-button--primary login'>{{_ "Use_this_username"}}</button>
<button type="reset" class='rc-button rc-button--nude'>{{_ "Logout"}}</button>
</div>
{{/if}}
</form>
Expand Down
4 changes: 3 additions & 1 deletion packages/rocketchat-ui-login/client/username/username.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ Template.username.events({
return $(event.currentTarget).parents('.input-text').removeClass('focus');
}
},

'reset #login-card'() {
Meteor.logout();
},
'submit #login-card'(event, instance) {
event.preventDefault();

Expand Down
58 changes: 55 additions & 3 deletions packages/rocketchat_theme/client/imports/forms/button.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@
&--icon > svg {
margin: 0 5px 0 -5px;

font-size: 20px;
fill: currentColor;

.rtl & {
margin: 0 -5px 0 5px;
}

font-size: 20px;
fill: currentColor;
}

position: relative;

display: flex;

min-height: 40px;
Expand All @@ -38,6 +40,32 @@
align-items: center;
justify-content: center;

&:active,
&:focus:hover {
outline: none;
}

&:active {
transform: translateY(2px);

opacity: 0.9;
}

&:active::before {
top: -2px;
}

&::before {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;

content: "";
cursor: pointer;
}

&:disabled {
cursor: default;

Expand Down Expand Up @@ -149,6 +177,30 @@
margin: 0 5px;
}
}

&__group {
display: flex;

flex-direction: row;

margin: 10px -5px;

& > .rc-button {
margin: 0 5px;
}

&--stretch {
justify-content: stretch;

& > .rc-button {
flex: 1 1;
}
}

&--vertical {
flex-direction: column;
}
}
}

@media (width < 780px) {
Expand Down
11 changes: 0 additions & 11 deletions packages/rocketchat_theme/client/imports/general/base_old.css
Original file line number Diff line number Diff line change
Expand Up @@ -4544,17 +4544,6 @@ body:not(.is-cordova) {
font-size: 10px;
}

& .submit,
& .register,
& .forgot-password,
& .back-to-login {
margin-top: 12px;

& button {
margin: 0 auto;
}
}

& .input-line {
position: relative;

Expand Down
6 changes: 3 additions & 3 deletions tests/pageobjects/login.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import mainContent from './main-content.page';

class LoginPage extends Page {
get registerButton() { return browser.element('button.register'); }
get forgotPasswordButton() { return browser.element('button.forgot-password'); }
get backToLoginButton() { return browser.element('button.back-to-login'); }
get submitButton() { return browser.element('.submit > button'); }
get forgotPasswordButton() { return browser.element('.forgot-password'); }
get backToLoginButton() { return browser.element('.back-to-login'); }
get submitButton() { return browser.element('.login'); }

get emailOrUsernameField() { return browser.element('[name=emailOrUsername]'); }
get nameField() { return browser.element('[name=name]'); }
Expand Down