mirror of
https://codeberg.org/TicklishHoneyBee/CLIte.git
synced 2026-03-11 09:04:37 +00:00
check for user account during login
This commit is contained in:
parent
0aa936525a
commit
6c5dff88ce
1 changed files with 18 additions and 12 deletions
|
|
@ -296,7 +296,6 @@ EDITOR=/bin/vi
|
|||
root:$-7a1c0437:0:0:root:/root:/bin/sh
|
||||
guest:x:1:1:guest:/usr/home/guest:/bin/sh
|
||||
`;
|
||||
// TODO: check cookies for a local user
|
||||
n.mode = clite.lib.modestr('-rw-------');
|
||||
}
|
||||
// /etc/group contains group details
|
||||
|
|
@ -311,7 +310,6 @@ guest:x:1:1:guest:/usr/home/guest:/bin/sh
|
|||
root:x:0:root
|
||||
guest:x:1:guest
|
||||
`;
|
||||
// TODO: check cookies for a local user
|
||||
n.mode = clite.lib.modestr('-rw-r--r--');
|
||||
}
|
||||
// /etc/greeting is displayed by the shell after login
|
||||
|
|
@ -543,14 +541,11 @@ license.txt:/etc/license:0:0:-rw-r--r--`;
|
|||
}
|
||||
// check cookies for login
|
||||
clite.log.write('Checking for user session');
|
||||
if (clite.user.init(vfsapi)) {// if logged in:
|
||||
clite.log.write('found user session?');
|
||||
// create user session
|
||||
}else{// if new user:
|
||||
clite.log.write('Generating guest session');
|
||||
clite.user.genGuest();
|
||||
// create the login shell
|
||||
// should really have init/getty exec the shell with the env data etc
|
||||
clite.user.init(vfsapi);
|
||||
|
||||
{
|
||||
// create the login environment
|
||||
// spawns /bin/login on pid 1, optionally with default guest login
|
||||
var env = clite.user.getEnv(0);
|
||||
var io = {
|
||||
pid:0,
|
||||
|
|
@ -565,8 +560,11 @@ license.txt:/etc/license:0:0:-rw-r--r--`;
|
|||
}
|
||||
function init5(env,io) {
|
||||
clite.tty.clear(0);
|
||||
//clite.proc.setLogin(io.pid,1);
|
||||
clite.lib.exec('/bin/login',['login','guest'],env,io);
|
||||
var args = ['login'];
|
||||
// check for user-created account with password set
|
||||
if (!clite.user.hasAltLogin())
|
||||
args.push('guest');
|
||||
clite.lib.exec('/bin/login',args,env,io);
|
||||
}
|
||||
|
||||
init1();
|
||||
|
|
@ -1311,8 +1309,16 @@ cat -l /usr/share/introduction
|
|||
});
|
||||
return d;
|
||||
}
|
||||
clite.user.hasAltLogin = function() {
|
||||
data.users.forEach(function(u) {
|
||||
if (u.name != 'root' && u.pass != 'x')
|
||||
return true;
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
loadUsers();
|
||||
clite.user.genGuest();
|
||||
|
||||
return false;
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue