Skip to content
This repository has been archived by the owner on Jan 10, 2022. It is now read-only.

Commit

Permalink
Finalize external logins
Browse files Browse the repository at this point in the history
  • Loading branch information
richtera committed Oct 14, 2012
1 parent 99f8728 commit e5b4f6d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 16 deletions.
3 changes: 3 additions & 0 deletions lib/conf/default.json
Expand Up @@ -4,6 +4,9 @@
"database": {
"uri":"mongodb://localhost/calipso"
},
"authentication": {
"password": true
},
"server": {
"name":"Calipso",
"url":"http://localhost:3000",
Expand Down
17 changes: 9 additions & 8 deletions modules/core/admin/admin.js
Expand Up @@ -721,20 +721,21 @@ function coreConfig(req, res, template, block, next) {
id:'form-section-authentication',
label:'Authentication',
fields:[
{ label:'Password Login and Registration',
legend:'Password Login and Registration',
{ label:'Password Login and Registration (changes require a restart of calipso)',
legend:'Password Login and Registration (changes require a restart of calipso)',
type:'fieldset',
fields: [
{
label:'Enable password authentication and registration',
type:'checkbox',
name:'server:authentication:password',
description:'Please make sure you have made an external user (google, facebook or twitter an admin account) so you don\'t lose access to your system.',
defaultValue:true
}
]
},
{ label:'Facebook Authentication',
legend:'Set this information to enable Facebook Authentication',
{ label:'Facebook Authentication (changes require a restart of calipso)',
legend:'Set this information to enable Facebook Authentication (changes require a restart of calipso)',
type:'fieldset',
fields:[
{
Expand All @@ -751,8 +752,8 @@ function coreConfig(req, res, template, block, next) {
}
]
},
{ label:'Google Authentication',
legend:'Set this information to enable Google Authentication',
{ label:'Google Authentication (changes require a restart of calipso)',
legend:'Set this information to enable Google Authentication (changes require a restart of calipso)',
type:'fieldset',
fields: [
{
Expand All @@ -775,8 +776,8 @@ function coreConfig(req, res, template, block, next) {
}
]
},
{ label:'Twitter Authentication',
legend:'Set this information to enable Twitter Authentication',
{ label:'Twitter Authentication (changes require a restart of calipso)',
legend:'Set this information to enable Twitter Authentication (changes require a restart of calipso)',
type:'fieldset',
fields: [
{
Expand Down
19 changes: 13 additions & 6 deletions modules/core/user/user.js
Expand Up @@ -171,10 +171,10 @@ function userDisplay(req, username, next) {
}

function userFields() {
var fields = [
var fields = calipso.auth.password ? [
{label:'Username', name:'user[username]', type:'text'},
{label:'Password', name:'user[password]', type:'password'}
];
] : [];
if (calipso.auth.google) {
fields.push({name:'google',text:'Use Google Login', type:'link', href:'/auth/google', cls:'googleicon'});
}
Expand All @@ -192,13 +192,20 @@ function userFields() {
*/
function loginForm(req, res, template, block, next) {
var fields = userFields();
var userForm = {
id:'login-form',cls:'login',title:'Log In',type:'form',method:'POST',action:'/user/login',
fields:fields,
buttons:[
var buttons = calipso.auth.password ?
[
{name:'submit', type:'submit', value:'Login'},
{name:'register', type:'link', href:'/user/register', value:'Register'}
]
:
[
{name:'submit', type:'submit', value:'Login'}
];

var userForm = {
id:'login-form',cls:'login',title:'Log In',type:'form',method:'POST',action:'/user/login',
fields:fields,
buttons:buttons
};

calipso.form.render(userForm, null, req, function(form) {
Expand Down
6 changes: 4 additions & 2 deletions themes/core/cleanslate/templates/default/secondaryMenu.html
@@ -1,7 +1,9 @@
<div id="user-welcome-or-login">
<a href="/user/login"><%= t('Log In') %></a>
<span class="link-divider">|</span>
<a href="/user/register"><%= t('Register') %></a>
<% if (config.get('server:authentication:password')) { %>
<span class="link-divider">|</span>
<a href="/user/register"><%= t('Register') %></a>
<% } %>
</div>
<div id="searchForm">
<%- searchForm %>
Expand Down

0 comments on commit e5b4f6d

Please sign in to comment.