mirror of
https://github.com/moparisthebest/user_sql
synced 2024-11-24 10:02:19 -05:00
Added support for mySQL PASSWORD() function
This commit is contained in:
parent
ceecf8a138
commit
e60f933d3f
@ -1 +1 @@
|
||||
0.6
|
||||
0.7
|
||||
|
@ -24,7 +24,7 @@
|
||||
<p><label for="sql_column_username"><?php echo $l->t('Username Column');?></label><input type="text" id="sql_column_username" name="sql_column_username" value="<?php echo $_['sql_column_username']; ?>" /></p>
|
||||
<p><label for="sql_column_password"><?php echo $l->t('Password Column');?></label><input type="text" id="sql_column_password" name="sql_column_password" value="<?php echo $_['sql_column_password']; ?>" /></p>
|
||||
<p><label for="crypt_type"><?php echo $l->t('Encryption Type');?></label>
|
||||
<?php $crypt_types = array('md5' => 'MD5', 'md5crypt' => 'MD5 Crypt', 'cleartext' => 'Cleartext', 'mysql_encrypt' => 'mySQL ENCRYPT()', 'system' => 'System');?>
|
||||
<?php $crypt_types = array('md5' => 'MD5', 'md5crypt' => 'MD5 Crypt', 'cleartext' => 'Cleartext', 'mysql_encrypt' => 'mySQL ENCRYPT()', 'system' => 'System (crypt)', 'mysql_password' => 'mySQL PASSWORD()');?>
|
||||
<select id="crypt_type" name="crypt_type">
|
||||
<?php
|
||||
foreach ($crypt_types as $driver => $name):
|
||||
|
24
user_sql.php
24
user_sql.php
@ -4,7 +4,7 @@
|
||||
* ownCloud - user_sql
|
||||
*
|
||||
* @author Andreas Böhler
|
||||
* @copyright 2012 Andreas Böhler <andreas (at) aboehler (dot) at>
|
||||
* @copyright 2012/2013 Andreas Böhler <andreas (at) aboehler (dot) at>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
@ -374,6 +374,28 @@ class OC_USER_SQL extends OC_User_Backend implements OC_User_Interface {
|
||||
$password = $row[0];
|
||||
}
|
||||
|
||||
elseif($this->crypt_type == 'mysql_password')
|
||||
{
|
||||
if(!$this->db_conn)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
$query = "SELECT PASSWORD(:pw);";
|
||||
|
||||
$result = $this->db->prepare($query);
|
||||
$result->bindParam(":pw", $pw);
|
||||
if(!$result->execute())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
$row = $result->fetch();
|
||||
if(!$row)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
$password = $row[0];
|
||||
}
|
||||
|
||||
else {
|
||||
OC_Log::write('OC_USER_SQL', "unknown/invalid crypt_type settings: $this->crypt_type", OC_Log::ERROR);
|
||||
die ('unknown/invalid Encryption type setting: ' . $this->crypt_type);
|
||||
|
Loading…
Reference in New Issue
Block a user