Skip to content

Commit

Permalink
Merge pull request #31 from chebykinn/redox_users
Browse files Browse the repository at this point in the history
Migrate to redox_users
  • Loading branch information
jackpot51 committed Nov 11, 2017
2 parents 9ec6959 + 33c3bfb commit 5098ddc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 61 deletions.
61 changes: 7 additions & 54 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ orbimage = "0.1"
orbtk = "0.2"
tendril = "0.4"
url = "1.5"
userutils = { git = "https://github.com/redox-os/userutils.git" }
redox_users = { git = "https://github.com/redox-os/users.git" }

[dependencies.hyper]
version = "0.10"
Expand Down
12 changes: 6 additions & 6 deletions src/orblogin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use std::process::Command;
use orbclient::{Color, EventOption, Renderer, Window, WindowFlag};
use orbfont::Font;
use orbimage::Image;
use userutils::Passwd;
use redox_users::User;

#[derive(Clone, Copy)]
enum BackgroundMode {
Expand Down Expand Up @@ -85,7 +85,7 @@ fn login_command(user: &str, pass: &str, launcher_cmd: &str, launcher_args: &[St

let mut passwd_option = None;
for line in passwd_string.lines() {
if let Ok(passwd) = Passwd::parse(line) {
if let Ok(passwd) = User::parse(line) {
if user == passwd.user && "" == passwd.hash {
passwd_option = Some(passwd);
break;
Expand All @@ -95,8 +95,8 @@ fn login_command(user: &str, pass: &str, launcher_cmd: &str, launcher_args: &[St

if passwd_option.is_none() {
for line in passwd_string.lines() {
if let Ok(passwd) = Passwd::parse(line) {
if user == passwd.user && passwd.verify(&pass) {
if let Ok(passwd) = User::parse(line) {
if user == passwd.user && passwd.verify_passwd(&pass) {
passwd_option = Some(passwd);
break;
}
Expand All @@ -113,12 +113,12 @@ fn login_command(user: &str, pass: &str, launcher_cmd: &str, launcher_args: &[St
command.uid(passwd.uid);
command.gid(passwd.gid);

command.current_dir(passwd.home);
command.current_dir(passwd.home.clone());

command.env("USER", &user);
command.env("UID", format!("{}", passwd.uid));
command.env("GROUPS", format!("{}", passwd.gid));
command.env("HOME", passwd.home);
command.env("HOME", passwd.home.clone());
command.env("SHELL", passwd.shell);

Some(command)
Expand Down

0 comments on commit 5098ddc

Please sign in to comment.