Tag Archive for user

User stylesheet for Snipplr

@-moz-document url-prefix("http://snipplr.com/") {

code {

font-family:"Envy Code R", "Consolas", "DejaVu Sans Mono", "Anonymous Pro", "Courier New", monospace !important;

font-size:0.9em !important;

background-color:#E0E0E0 !important;

}

#meerkat-wrap, a.adhere, a.ad1, ins, #top-banner {

display:none !important; /*remove ads*/

}

}

@-moz-document url-prefix("http://snipplr.com/edit/"), url-prefix("http://snipplr.com/new/") {

#title, #tags, #url, #comment {

font-family:Arial, sans serif !important;

font-size:1em !important;

font-style:normal !important;

}

#source {

font-family:"Envy Code R", "Consolas", "DejaVu Sans Mono", "Anonymous Pro", "Courier New", monospace !important;

font-size:0.9em !important;

height:26em !important;

}

#comment {

height:11em !important;

}

#sidecol {

display:none !important;

}

#maincol {

margin-right:0 !important;

padding-right:0 !important;

border-right:0 !important;

}

#maincol p {

padding-right:15px !important;

}

#comment, #source {

width:100% !important;

}

}

@-moz-document url-prefix("http://snipplr.com/view/"), url-prefix("http://snipplr.com/view.php?codeview") {

div.description pre, .comments pre {

color:#000000 !important;

background-color:#E0E0E0 !important;

margin:1.4em !important;

border:1px dashed #E0E0E0 !important;

font-size:0.9em !important;

}

#innersource pre, #viewsource textarea {

font-family:"Envy Code R", "Consolas", "DejaVu Sans Mono", "Anonymous Pro", "Courier New", monospace !important;

font-size:13px !important;

}

#comment {

font-family:Arial, sans serif !important;

font-size:1em !important;

font-style:normal !important;

}

#viewsource .sourcenav {

text-align:right !important;

}

#viewsource .sourcenav .rgt {

float:none !important;

}

#viewsource .sourcenav ins { /*remove ads*/

visibility:hidden !important;

}

#sidecol h2:first-child, #sidecol ins { /*remove ads*/

/*display:none !important;*/

}

hr.dotted.marg + table, center ins { /*remove ads*/

display:none !important;

}

}

@-moz-document url-prefix("http://snipplr.com/") {

#sponsored-search { /*remove ads*/

display:none !important;

}

}

source

Create Username/Password for Samba – Ubuntu Shared Folder

sudo smbpasswd -a <username>

source

Drop Privileges

# Get the UID the application was started with
# which must have been 'root' if you want this process
# to have 'root' like abilities.
privUID = os.geteuid()
# Get the UID that the application should use for
# most of its processing, 'nobody' is usually
# a good choice.
normalUID = pwd.getpwnam( 'nobody' )[2]

def runAsNormal():
"""Switch this process to normal privileges, we shouldn't be able to
do anything naughty in this mode."""
os.seteuid( normalUID )
def runAsPrivileged():
"""Switch to super user privileges, here we can do anything we want."""
os.seteuid( privUID )

# Once program has initialized, drop privileges
runAsNormal()

# ... some normal application code...

# Do do something that requires super user privileges
try:
runAsPrivileged()
# ... do the stuff we need to be super for
finally:
# Switch out of super mode and back to normal
runAsNormal()

source

User Registration in CakePHP

<?php

/**
* Class used for user authentication on the league website
*
*/

class User extends AppModel
{
var $name = 'User';

var $validate = array(
'id' => array('rule' => 'blank',
'on' => 'create'),
'username' => array('rule' => 'alphanumeric',
'required' => true,
'message' => 'Please enter a username'),
'password' => array('rule' => array('confirmPassword', 'password'),
'message' => 'Passwords do not match'),
'password_confirm' => array('rule' => 'alphanumeric',
'required' => true)
);

function confirmPassword($data, $fieldName) {
$valid = false;

if ($data['password'] == Security::hash(Configure::read('Security.salt') . $this->data['User']['password_confirm'])) {
$valid = true;
}

return $valid;
}

}
?>

source