Skip to content
This repository has been archived by the owner on Sep 2, 2023. It is now read-only.

[FEAT] Logout: Auto logout from IDS on logout #2540

Merged
merged 10 commits into from
Jun 26, 2015
2 changes: 1 addition & 1 deletion src/js/controllers/app.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ function AppCtrl ($scope, id, net, keychain, txQueue, appManager, rpTracker,

$scope.logout = function () {
id.logout();
location.reload();
location.href = Options.ids_url + '/auth/logout?redirect=' + encodeURIComponent(location.href);
};

$scope.$on('$idRemoteLogout', handleRemoteLogout);
Expand Down
25 changes: 9 additions & 16 deletions src/js/services/id.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,14 @@
* The id service is used for user identification and authorization.
*/

var util = require('util'),
webutil = require('../util/web'),
settings = require('../util/settings'),
Base58Utils = require('../util/base58'),
RippleAddress = require('../util/types').RippleAddress;
var webutil = require('../util/web'),
settings = require('../util/settings');

var module = angular.module('id', ['authflow', 'blob']);

module.factory(
'rpId', ['$rootScope', '$location', '$route', '$routeParams', '$timeout',
'rpAuthFlow', 'rpBlob', '$q',
function($scope, $location, $route, $routeParams, $timeout,
$authflow, $blob, $q) {
'rpId', ['$rootScope', '$location', '$route', '$routeParams', '$timeout', 'rpAuthFlow', 'rpBlob', '$q',
function($scope, $location, $route, $routeParams, $timeout, $authflow, $blob, $q) {
/**
* Identity manager
*
Expand Down Expand Up @@ -350,8 +345,7 @@ module.factory(
});
};

Id.prototype.logout = function()
{
Id.prototype.logout = function() {
store.remove('backend_token');

// TODO make it better
Expand All @@ -373,7 +367,9 @@ module.factory(

Id.prototype.unlock = function(username, password, callback) {
// Callback is optional
if('function' !== typeof callback) callback = $.noop;
if ('function' !== typeof callback) {
callback = $.noop;
}

// username = Id.normalizeUsernameForDisplay(username);
// password = Id.normalizePassword(password);
Expand All @@ -393,7 +389,7 @@ module.factory(
* Redirects the user to a page where they can identify. This could be the
* login tab most likely.
*/
Id.prototype.goId = function () {
Id.prototype.goId = function() {
if (!this.isLoggedIn()) {
if (_.size($routeParams)) {
var tab = $route.current.tabName;
Expand Down Expand Up @@ -421,9 +417,6 @@ module.factory(
return this.resolvedNames[address];
};

/**
*
*/
Id.prototype.addressDontHaveName = function(address) {
return this.resolvedNames[address] === address;
};
Expand Down
5 changes: 2 additions & 3 deletions src/js/tabs/login.controller.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@

'use strict';

var util = require('util');
var Tab = require('../client/tab').Tab;

var LoginTab = function()
{
var LoginTab = function() {
Tab.call(this);
};

Expand Down
2 changes: 1 addition & 1 deletion src/less/ripple/content.less
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// Temporary
@media (max-width: @screen-xs-max) {
.t-login, .t-register, .t-migrate, .t-tou, .t-privacypolicy {
.t-login, .t-tou, .t-privacypolicy {
header {
display: none;
}
Expand Down
33 changes: 4 additions & 29 deletions src/less/ripple/landing.less
Original file line number Diff line number Diff line change
Expand Up @@ -148,24 +148,24 @@ header.loggedOut {
}
}

#t-register .auth-form-container .auth-form-wrapper, #t-login .auth-form-container .auth-form-wrapper, #t-recover .auth-form-container .auth-form-wrapper, #t-account .auth-form-container .auth-form-wrapper, #t-migrate .auth-form-container .auth-form-wrapper {
#t-login .auth-form-container .auth-form-wrapper, #t-account .auth-form-container .auth-form-wrapper {
float: right;
border: none;
background: rgba(76, 141, 184, .8);
border-radius: 5px;
}

#t-register .auth-form-container h2, #t-login .auth-form-container h2, #t-recover .auth-form-container h2, #t-account .auth-form-container h2, #t-migrate .auth-form-container h2 {
#t-login .auth-form-container h2, #t-account .auth-form-container h2 {
color: @white;
width: 100%;
margin: 0;
}

#t-register .auth-form-container .auth-form-wrapper label, #t-login .auth-form-container .auth-form-wrapper label, #t-recover .auth-form-container .auth-form-wrapper label, #t-account .auth-form-container .auth-form-wrapper label, #t-migrate .auth-form-container .auth-form-wrapper label, #t-register .auth-form-container .see-privacy-text, #t-login .auth-form-container .see-privacy-text, #t-recover .auth-form-container .see-privacy-text, #t-account .auth-form-container .see-privacy-text, #t-migrate .auth-form-container .see-privacy-text {
#t-login .auth-form-container .auth-form-wrapper label, #t-account .auth-form-container .auth-form-wrapper label, #t-login .auth-form-container .see-privacy-text, #t-account .auth-form-container .see-privacy-text {
color: @landingblue;
}

#t-register .auth-form-container .sign-up-steps-list li.active, #t-login .auth-form-container .sign-up-steps-list li.active, #t-recover .auth-form-container .sign-up-steps-list li.active, #t-account .auth-form-container .sign-up-steps-list li.active, #t-migrate .auth-form-container .sign-up-steps-list li.active {
#t-login .auth-form-container .sign-up-steps-list li.active, #t-account .auth-form-container .sign-up-steps-list li.active {
color: @white;
border-bottom: 1px solid @white !important;
}
Expand Down Expand Up @@ -421,31 +421,6 @@ header.loggedOut {

}

//register specific
#t-register {

h2.loginTop a {
color: @midgray !important;
display: block;
background: rgba(0,0,0,0.2);
padding: 15px;
&:hover {
color: @white !important;
}
}

.tabBg {
background: rgba(0,0,0,.6);
height: 100px;
width: 16%;
position: absolute;
right: 15px !important;
border-top-right-radius: 5px;
cursor: pointer;
}

}

//privacy policy and tou
.t-privacypolicy, .t-tou {

Expand Down
55 changes: 3 additions & 52 deletions src/less/ripple/tabs/authorization.less
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.t-register, .t-login, .t-recover, .t-migrate {
.t-login {
header nav {
display: none;
}
}
#t-register, #t-login, #t-recover, #t-account, #t-migrate {
#t-login, #t-account {
a {
text-decoration: none;
&:hover, &:focus {
Expand Down Expand Up @@ -238,56 +238,7 @@
}
}
}
#t-register {
.auth-form-container {
&.mode-verification {
.auth-form-wrapper {
.btn-cancel {
.loading_text {
text-transform: lowercase;
}
}
}
}
}
.register_masterkey {
position: relative;
.auth-attention {
margin-top: 30px;
text-align: center;
.recovery {
margin-top: 10px;
}
}
}
.welcome-wrapper {
text-align: center;
}
.platform, h4.new {
max-width: 700px;
margin: auto;
}
h4.new {
padding: 25px 0;
border-top: 1px solid @midgray;
font-weight: 200;
font-size: 1.1em;
}
span.currency {
font-weight: 500;
}
.xrp-xau {
font-size: 1.2em;
}
}
#t-migrate {
.text-status {
#error {
font-size: 12px;
color: @midred;
}
}
}

#t-login {
@media (max-width: @screen-xs-max) {
.content {
Expand Down
10 changes: 0 additions & 10 deletions src/templates/tabs/login.jade
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,7 @@ section.col-xs-12.content(ng-controller="LoginCtrl")
span(l10n) Sign Up
button.btn.btn-submit.btn-block.btn-success#loginBtn(type="submit" ng-click="submitForm('login')")
span(l10n) Sign In
.input-group.col-xs-12
input(name='redirect_to', type='hidden', value='{{redirectTo}}')
label
input.rememberMe(name='remember_me', type='checkbox')
span(for='remember_me', l10n) Remember me on this device for 30 days
.row.switch-mode-wrapper
.switch-mode-link-container.bottomText(l10n)
| Ripple Trade uses  
a(href="https://id.ripple.com") RippleID  
| to securely manage your personal information


.row.action-login(ng-if="$routeParams.to")
.col-xs-12.col-sm-6.col-md-6.uri-form-container
Expand Down
4 changes: 2 additions & 2 deletions src/templates/tabs/security.jade
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ section.col-xs-12.content(ng-controller="SecurityCtrl")
.section
.descriptor(l10n) Security settings
.row
label(l10n) You can now manage your secret settings such as secret key, password,
| and two-factor authentication through Ripple ID. Pressing edit will take you to id.ripple.com.
label(l10n) You can now manage your security settings such as secret key,
| password, and two-factor authentication by clicking edit.
.row.row-padding-small-xs
.col-xs-9.col-sm-8.col-md-6
.col-xs-3.col-sm-4.col-md-6
Expand Down
5 changes: 5 additions & 0 deletions test/selenium/tests-public/LoginRT.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@
"type": "waitForTextPresent",
"text": "BALANCES"
},
{
"type": "waitForTextPresent",
"text": "Connected to BrowserSync",
"negated": true
},
{
"type": "clickElement",
"locator": {
Expand Down
3 changes: 1 addition & 2 deletions test/travis/config-travis.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/
var Options = {
// Local domain
//
// Which domain should ripple-client consider native?
domain: 'ripp.site:3000',

Expand Down Expand Up @@ -85,7 +84,7 @@ var Options = {
gateway_max_limit: 1000000000,

// Ripple trade backend URL
backend_url: 'http://54.68.38.81:8080',
backend_url: 'http://54.68.38.81:8081',
ids_url: 'http://idripple.com',

ticker: {
Expand Down